--------------------------------  Espy Hack  --------------------------------
function SlobESPOn()
	SlobESPEnabled = true
	hook.Add("HUDPaint", "SlobESPOmg", function()
		draw.SimpleTextOutlined("Slob Bot", "ScoreboardText", 50, 10, Color(0, 0, 255, 255), 1, 1, 1, Color(255, 255, 255, 255))
		draw.SimpleTextOutlined("Wire Frame: "..tostring(wireframeenabled), "ScoreboardText", ScrW()/2, 10, Color(0, 0, 255, 255), 0, 1, 1, Color(255, 255, 255, 255))
		draw.SimpleTextOutlined("Banable: "..tostring(canban), "ScoreboardText", ScrW()/2, 25, Color(0, 0, 255, 255), 0, 1, 1, Color(255, 255, 255, 255))
		draw.SimpleTextOutlined("RP Wallhack: "..tostring(DarkRPWallhackEnabled), "ScoreboardText", ScrW()/2, 40, Color(0, 0, 255, 255), 0, 1, 1, Color(255, 255, 255, 255))
		for _, ent in pairs(ents.GetAll()) do
			if SlobBotAllowed(ent) then
				local epos = ent:GetPos()
				if epos:ToScreen().x > 0 and
				epos:ToScreen().y > 0 and
				epos:ToScreen().x < ScrW() and
				epos:ToScreen().y < ScrH() then
					local pos1 = (ent:LocalToWorld(Vector(0,0,70))):ToScreen()
					if ent:IsPlayer() then
						draw.SimpleTextOutlined("Name: "..ent:Nick(), "ScoreboardText", pos1.x, pos1.y+30, team.GetColor(ent:Team()), 2, 1, 1, Color(255, 255, 255, 255))
						draw.SimpleTextOutlined("Health: "..ent:Health(), "ScoreboardText", pos1.x, pos1.y+50, team.GetColor(ent:Team()), 2, 1, 1, Color(255, 255, 255, 255))
						if DarkRPWallhackEnabled then
							draw.SimpleTextOutlined("Money: $"..tonumber(ent:GetNWInt("money")), "ScoreboardText", pos1.x, pos1.y+70, team.GetColor(ent:Team()), 2, 1, 1, Color(255, 255, 255, 255))
						end

                        --local obbmax = ent:OBBMaxs()
		                --local obbsize = (ent:LocalToWorld(Vector(obbmax.x, obbmax.y, obbmax.z)):ToScreen())

						--surface.SetDrawColor(team.GetColor(ent:Team()))
						--surface.DrawOutlinedRect(1, 1, obbsize.y, obbsize.z)

					elseif ent:IsNPC() then
						draw.SimpleTextOutlined("Class: "..ent:GetClass(), "ScoreboardText", pos1.x, pos1.y+30, Color(0, 0, 255, 255), 2, 1, 1, Color(255, 255, 255, 255))
						--draw.SimpleTextOutlined("Health: "..ent:Health(), "ScoreboardText", pos1.x, pos1.y+50, Color(0, 0, 255), 2, 1, 1, Color(255, 255, 255, 255))
                    end

					if GetSlobBotTarget() == ent then
						draw.SimpleTextOutlined("TARGET", "ScoreboardText", pos1.x, pos1.y+10, Color(255, 0, 0, 255), 2, 1, 1, Color(255, 255, 255, 255))
						local tpos = HeadPosition(ent):ToScreen()
						local tcol
						if ent:IsPlayer() then
							tcol = team.GetColor(ent:Team())
						elseif ent:IsNPC() then
						    tcol = Color(0, 0, 255, 255)
						end
						surface.SetDrawColor(tcol.r, tcol.g, tcol.b, 255)
						surface.DrawLine(ScrW()/2, ScrH()/2, tpos.x, tpos.y)
					end
				end
		    end
	    end
    end)
end


concommand.Add("wots_toggleesp", function()
    if SlobESPEnabled then
	    hook.Remove("HUDPaint", "SlobESPOmg")
        SlobNotify("ESP: OFF")
		SlobESPEnabled = false
	elseif !SlobESPEnabled then
        SlobESPOn()
        SlobNotify("ESP: ON")
		SlobESPEnabled = true
    end
end)
-------------------------------------------------------------